<style>
#templatemo_menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

#templatemo_menu li {
  margin: 0 0 2px;
  padding: 3px 0 2px 0;
}

#templatemo_menu li a {
  display: block;
  height: 25px;
  font-size: 12px;
  color: white;
  padding: 7px 0 0 10px;
  font-weight: bold;
  text-decoration: none;

}

#templatemo_menu li a:hover, #templatemo_menu li .current {
  color: #C3F1F7;
  border-left: 5px solid #C3F1F7;

}
</style>
<div id="menu">
  <?php if ($sf_user->getUserId()): ?>
  <div id="user_box">
    <p>
      Bonjour <span class="username"><?php echo $sf_user->getUsername() ?></span>
    </p>
    <?php echo link_to(image_tag('/pwCorePlugin/images/icons/user_edit') . ' Modifier mon profil', '@member_edit?id=' . $sf_user->getUserId()) ?>
    <?php echo link_to(image_tag('/pwCorePlugin/images/logout') . ' Déconnexion', '@logout') ?>
  </div>
  <?php endif ?>

  <?php if($level_right != null): ?>
    <?php include_component('letsMember', 'searchBar') ?>
    
    <?php if($level_right == LetsMemberTable::MEMBER_LEVEL_ADMIN): ?>
      <?php echo include_component('menus', 'generateMenu'); ?>
    <?php else: ?>
      <?php if($level_right >= LetsMemberTable::MEMBER_LEVEL_NORMAL): ?>
      <ul id="templatemo_menu">
          <li class="mainSection">Menu</li>
          <li><?php echo link_to("Accueil", '@lets_home_member',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to("Voir ma fiche", '@member_show?id='.$current_user_id,array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Mes offres et demandes', '@lets_user_asksAndOffers',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Saisir un échange', '@lets_exchange_new',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Liste de mes échanges', '@lets_exchangesByUser_list',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Consulter les demandes', '@lets_user_asks_list',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Consulter les offres', '@lets_user_offers_list',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Liste des adhérents', '@lets_members_list',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Carte des adhérents', '@members_map',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Agenda', '@events_calendar',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Proposer un événement', '@event_new',array('class'=>'blue button')) ?></li>
          <li><?php echo link_to('Télécharger les offres / demandes', '@lets_allAsksOffers_export_pdf',array('class'=>'blue button','popup'=>true)) ?></li>
          <li><?php echo link_to("Télécharger l'annuaire", '@lets_members_export_pdf',array('class'=>'blue button','popup'=>true)) ?></li>
      </ul>
      <?php endif ?>
      <!-- manager menu -->
      <?php if($level_right >= LetsMemberTable::MEMBER_LEVEL_MANAGER): ?>
      <ul id="templatemo_menu">
          <li class="mainSection">Gestion</li>
          <?php if($user->hasPermission(LetsManagerRights::ADD_EXCHANGE_OTHERS)): ?>
            <li><?php echo link_to('Saisir un échange entre 2 adhérents', '@lets_exchangeByManager_new', array('class' => 'blue button')) ?></li>
          <?php endif ?>
          <?php if($user->hasPermission(pwEventsPluginUtil::RIGHT_EDIT_AND_VALIDATE_EVENT)): ?>
            <li><?php echo link_to('Validation événements', '@events_list', array('class' => 'blue button')) ?></li>
          <?php endif ?>
          <?php if($user->hasPermission(LetsManagerRights::SEE_EXCHANGES_LIST)): ?>
            <li><?php echo link_to("Liste des échanges", '@lets_exchange_list',array('class'=>'blue button')) ?></li>
          <?php endif ?>
          <?php if($user->hasPermission(LetsManagerRights::SEE_EXCHANGES_STATS)): ?>
            <li><?php echo link_to('Statistiques des membres', '@lets_membersStats_list', array('class' => 'blue button')) ?></li>
          <?php endif ?>
          <?php if($user->hasPermission('add_member')): ?>
            <li><?php echo link_to('Ajouter un adhérent', '@member_new', array('class' => 'blue button')) ?></li>
          <?php endif ?>
          <?php if($user->hasPermission('edit_member')): ?>
            <li><?php echo link_to('Gestion des adhérents', '@members_list', array('class' => 'blue button')) ?></li>
          <?php endif ?>
          <?php if($user->hasPermission('mailing')): ?>
           <li><?php echo link_to('Mailing', '@mailing', array('class' => 'blue button')) ?></li>
         <?php endif ?>
       
         <!-- <li><?php //echo link_to('Paiement de masse', '@lets_mass_payment', array('class' => 'blue button')) ?></li>-->
      </ul>
      <?php endif ?>
    <?php endif ?>
  <?php endif ?>
</div>